Requirements

Tested on a TexLive distribution using XeLaTeX. I cannot guarantee that other formats or LaTeX engines will work. (In fact, they probably won’t.)

In addition, this particular example assumes that you have the Arial Narrow font installed on your system.

Example figure using non-standard fonts

if (!require("pacman")) install.packages("pacman")
## Loading required package: pacman
pacman::p_load(ggplot2, hrbrthemes)

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="Fuel efficiency (mpg)", y="Weight (tons)",
       title="This plot uses Arial Narrow fonts",
       caption="Note: Fonts must be installed separately on your system.") + 
  theme_ipsum()

Interactive content when exporting to PDF

In general, this template tries to do a good job of automatically handling (i.e. ignoring) interactive content when exporting to PDF. A notable exception is with embedded interactive content like external GIFs. In this case, rather than typing the usual, say, ![](mind-blown.gif) directly in the Rmd file, you should include the figure with knitr::include_graphics in an R chunk. This will allow you to control whether it renders, conditional on output format. For example: